package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class ReasonCancel extends AbstractData {
	
	private long id  = -1;
	private String reason ;
	private String Description;
	private  boolean status;
	private boolean avaliable;
	
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getReason() {
		return reason;
	}
	public void setReason(String reason) {
		this.reason = reason;
	}
	public String getDescription() {
		return Description;
	}
	public void setDescription(String description) {
		Description = description;
	}
	public boolean isStatus() {
		return status;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}
	public boolean isAvaliable() {
		return avaliable;
	}
	public void setAvaliable(boolean avaliable) {
		this.avaliable = avaliable;
	}
	
	
	public Entity getEntity()
	{
		Entity item;
		if(this.key == null)
			item = new Entity(EntityName.ReasonCancel);
		else
			item = new Entity(this.key);
		
		item.setProperty("Reason", this.reason);
		item.setProperty("Description", this.Description);
		item.setProperty("status",this.status);
		item.setProperty("avaliable",this.avaliable);
	
		return item;
	}

	@Override
	public void setEntity(Entity entity) {
		
		this.id = entity.getKey().getId();
		this.reason= (String) entity.getProperty("Reason");
		this.Description= (String) entity.getProperty("Description");
		this.status= (Boolean) entity.getProperty("status");
		this.avaliable =(Boolean) entity.getProperty("avaliable");

		this.key = entity.getKey();
	}
	
	public void LoadData() {
		if (this.id > -1) {
			Entity entity = LoadData(EntityName.ReasonCancel, this.id);
			setEntity(entity);
		}
	}

}
